#define _CRT_SECURE_NO_WARNINGS 1
#include"my_string.h"

int my_strncmp(const char* p1, const char* p2, size_t n){
	assert(p1 && p2);
	while (n--) {
		if (*p1 == *p2) {
			if (*p1 == '\0')
				return 0;
			else {
				p1++;
				p2++;
			}
		}
		else
			return *p1 - *p2;
	}
}

int my_strcmp(const char* p1, const char* p2){
	size_t n1 = my_strlen1(p1);
	size_t n2 = my_strlen1(p2);
	size_t n = n1 > n2 ? n2 : n1;
	return my_strncmp(p1, p2, n);
	/*assert(p1 && p2);
	while (*p1 == *p2){
		if (*p1 == '\0')
			return 0;
		else{
			p1++;
			p2++;
		}
	}
	return *p1 - *p2;*/
}